const Koa = require("koa")

const app = new Koa();

app.use((ctx, next) => {
  console.log("中间件被执行");
  if (ctx.request.url === "/login") {
    if (ctx.request.method === "GET") {
      ctx.response.body = "Login"
    }
  } else {
    ctx.response.body = "other Login"
  }
})

app.listen(8000, () => {
  console.log("koa初体验服务器启动成功");
})